-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.x: Add explanation text to Undeliverable & OnErrorNotImplemented exs #6171
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #6171 +/- ##
============================================
+ Coverage 98.21% 98.21% +<.01%
+ Complexity 6199 6197 -2
============================================
Files 667 667
Lines 44879 44879
Branches 6214 6214
============================================
+ Hits 44076 44078 +2
+ Misses 258 257 -1
+ Partials 545 544 -1
Continue to review full report at Codecov.
|
@@ -48,6 +48,6 @@ public OnErrorNotImplementedException(String message, @NonNull Throwable e) { | |||
* the {@code Throwable} to signal; if null, a NullPointerException is constructed | |||
*/ | |||
public OnErrorNotImplementedException(@NonNull Throwable e) { | |||
super(e != null ? e.getMessage() : null, e != null ? e : new NullPointerException()); | |||
this("The onError handler in the subscribe() method is not provided. Please specify it to avoid this type of exception. Further reading: https://github.com/ReactiveX/RxJava/blob/2.x/docs/Error-Handling.md | " + (e != null ? e.getMessage() : ""), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify it to avoid this type of exception.
I'm afraid this advice is too similar to generic error handling like this
try {
method();
} catch (Throwable t) {
t.printStackTrace();
}
What about something like:
An error occurred in the flow but no error handler was provided. Further reading: https://github.com/ReactiveX/RxJava/blob/2.x/docs/Error-Handling.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"no error handler was provided"
I'm worried users will think having or adding doOnError
will solve the error, hence the explicit mention of subscribe()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see
Well, I'm not against mentioning subscribe()
as long as we don't just say to "set this error handler to avoid this exception"
We can also mention onErrorXXX
, might be a bit overwhelming tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this:
The exception was not handled due to missing onError handler in the subscribe() method call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR adds detailed error message to the
UndeliverableException
andOnErrorNotImplementedException
as they are the most common exception-related questions around.UndeliverableException
OnErrorNotImplementedException